package com.example.ui.share.adapter;

import com.example.huashangapp.R;
import com.example.ui.share.adapter.MyCircleAdapter.Holder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class HotCircleAdapter extends BaseAdapter {
	Context mContext;
	private LayoutInflater inflater;
	private String[] strText = {"企业运营","金融投资","财税筹划","人力资源","市场营销","物流生产","领导艺术"};
	private int[] imgArr = {R.drawable.nan2,R.drawable.nan2,R.drawable.nan2,
			R.drawable.nan2,R.drawable.nan2,R.drawable.nan2,
			R.drawable.nan2};
	
	public HotCircleAdapter(Context context){
		mContext = context;
		inflater=LayoutInflater.from(mContext);
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return strText.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Holder holder = null;
		if(convertView == null){
			convertView = inflater.inflate(R.layout.item01_listview_item, null);
			holder = new Holder();
        	holder.img = (ImageView)convertView.findViewById(R.id.item01_list_img);
			holder.textTitle = (TextView) convertView.findViewById(R.id.item01_list_text_title);
			holder.textNum = (TextView) convertView.findViewById(R.id.item01_list_text_num);
        	convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }
		
		holder.img.setBackgroundResource(imgArr[position]);
		holder.textTitle.setText(strText[position]);
		holder.textNum.setText("( 147个课程,41位讲师 )");
		return convertView;
	}
	
	class Holder{
    	ImageView img;
    	TextView textTitle;
    	TextView textNum;
    }

}
